﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>v-for的初步使用</title>
    <link href="../css/bootstrap.css"/>
    <link href="../css/bootstrap-theme.css"/>
</head>
<body>
<h1>v-for的初步使用</h1><br/>

<div id="app">
    <table>
        <thead>
            <tr>
                <th>索引</th>
                <th>id</th>
                <th>标签</th>
                <th>v-for之外不同作用域</th>
            </tr>
        </thead>

        <tbody>
            <tr v-for="(v,key) in arr">
                <td>{{key}}</td>
                <td>{{v.id}}</td>
                <td>{{v.title}}</td>
                <td>{{name}}</td>
            </tr>
        </tbody>
    </table>
    <ul>
        <li v-for="v in arr">
            {{v.id}}&nbsp;&nbsp;-----{{v.title}}
        </li>
    </ul>
</div>
<script src="../js/jquery-2.2.0.min.js"></script>
<script src="../js/vue-2.5.16.js"></script>
<script src="../node_modules/axios/dist/axios.js"></script>
<script src="../node_modules/lodash/lodash.js"></script>

<script>
    var app = new Vue({
        el: '#app',
        data: {
            name:'kyo',
            arr: [
                {id: '3', title: 'id为3的对象'},
                {id: '2', title: 'id为2的对象'},
                {id: '1', title: 'id为1的对象'},
                {id: '4', title: 'id为4的对象'}
            ]
        }
    });
</script>

</body>
</html>